import { View } from "../../../mvc/core/View";
import { LayerManager } from "../../manager/LayerManager";
import { ObjCreate } from "../common/ObjCreate";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../extend/language/Language";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class WarScoreView
    
    export  class WarScoreView extends View
    {
        constructor()
        {
            super();
            this.layer = LayerManager.uiLayer;
            this.x = 0;
            this.y = 125;
            this.initUI();
            return;
        }

        protected initSize(): void
        {
            this._bgW = 181;
            this._bgH = 208;
            return;
        }

        protected initUI(): void
        {
            this.mouseEnabled = false;
            this.initSize();
            this._bodySp = new Object /* flash.display.Sprite */();
            this.addChild(this._bodySp);
            this._topSp = new Object /* flash.display.Sprite */();
            this._bodySp.addChild(this._topSp);
            this._moveBtn = ObjCreate.createGButton("", 0, 3, 24, 22, this._topSp, "MoveBtn");
            this._moveBtn.toolTipData = HTMLUtil.addColor(Language.getString(41819), "#FFFFFF");
            this._btnDetails = ObjCreate.createGButton("", 25, 0, 135, 28, this._topSp, "TabButtonBig2");
            this._btnDetails.toolTipData = HTMLUtil.addColor(Language.getString(41820), "#FFFFFF");
            var loc1=GlobalClass.getBitmap("guildWarDetails");
            loc1.x = 30;
            loc1.y = 3;
            this._btnDetails.addChild(loc1);
            this._btnUp = ObjCreate.createGButton("", 160, 0, 24, 25, this._topSp, "BattlefieldIconUpBtn");
            this._btnDown = ObjCreate.createGButton("", 160, 0, 24, 25, null, "BattlefieldIconDownBtn");
            this._btnUp.addEventListener(flash.events.MouseEvent.CLICK, this.onClickUp);
            this._btnDown.addEventListener(flash.events.MouseEvent.CLICK, this.onClickDown);
            this._spContent = new Object /* flash.display.Sprite */();
            this._spContent.mouseChildren = false;
            this._spContent.mouseEnabled = false;
            this._spContent.y = 22;
            this._bodySp.addChild(this._spContent);
            this._bgBitmapData = new Object /* flash.display.BitmapData */(this._bgW, this._bgH, true, 4278190080);
            var loc2=new Object /* flash.display.Bitmap */(this._bgBitmapData);
            loc2.alpha = 0.5;
            this._spContent.addChild(loc2);
            this._moveBtn.addEventListener(flash.events.MouseEvent.MOUSE_UP, this.onMoveBtnHandler);
            this._moveBtn.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, this.onMoveBtnHandler);
            this._btnDetails.addEventListener(flash.events.MouseEvent.CLICK, this.onShowDetailsHandler);
            return;
        }

        protected updateSize(arg1: number, arg2: number): void
        {
            this._bgW = arg1;
            this._bgH = arg2;
            this._bgBitmapData = new Object /* flash.display.BitmapData */(this._bgW, this._bgH, true, 4278190080);
            return;
        }

        protected onMoveBtnHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (arg1.type == flash.events.MouseEvent.MOUSE_DOWN) 
            {
                this.startDrag();
            }
            if (arg1.type == flash.events.MouseEvent.MOUSE_UP) 
            {
                this.stopDrag();
            }
            return;
        }

        protected onShowDetailsHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            return;
        }

        protected onClickUp(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._btnUp.parent) 
            {
                this._btnUp.parent.removeChild(this._btnUp);
            }
            this._topSp.addChild(this._btnDown);
            if (this._spContent.parent) 
            {
                this._spContent.parent.removeChild(this._spContent);
            }
            return;
        }

        protected onClickDown(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._btnDown.parent) 
            {
                this._btnDown.parent.removeChild(this._btnDown);
            }
            this._topSp.addChild(this._btnUp);
            this._bodySp.addChild(this._spContent);
            return;
        }

        protected /* var */_bodySp: Object /* flash.display.Sprite */;

        protected /* var */_bgBitmapData: Object /* flash.display.BitmapData */;

        protected /* var */_topSp: Object /* flash.display.Sprite */;

        protected /* var */_btn2: GButton;

        protected /* var */_moveBtn: GButton;

        protected /* var */_btnDetails: GButton;

        protected /* var */_btnUp: GButton;

        protected /* var */_btnDown: GButton;

        protected /* var */_spContent: Object /* flash.display.Sprite */;

        protected /* var */_bgW: int;

        protected /* var */_bgH: int;
    }
